package com.gdhuarui.service;

import com.gdhuarui.pojo.*;
import com.gdhuarui.mapper.AdminMapper;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.ArrayList;

@Service
public class AdminService {

    @Autowired
    public AdminMapper adminMapper;

    public ArrayList<Config> getConfigs() {return adminMapper.getConfigs();}

    public Page<News> getNews(String search) {return adminMapper.getNews(search);}

    public Integer addNewsAction(News news) {return adminMapper.addNewsAction(news);}

    public Integer deleteNews(Integer id) {return adminMapper.deleteNews(id);}

    public News selectNewsById(Integer id) {return adminMapper.selectNewsById(id);}

    public boolean updateNewsAction(News news) {return adminMapper.updateNewsAction(news);}

    public Page<Project> getProject(String search) {return adminMapper.getProject(search);}

    public boolean addProjectAction(Project project) {return adminMapper.addProjectAction(project);}

    public Integer deleteProject(int id) {return adminMapper.deleteProject(id);}

    public Project selectProjectById(int id) {return adminMapper.selectProjectById(id);}

    public boolean updateProjectAction(Project project) {return adminMapper.updateProjectAction(project);}

    public Page<Partner> getPartner(String search) {return adminMapper.getPartner(search);}

    public boolean addPartnerAction(Partner partner) {return adminMapper.addPartnerAction(partner);}

    public Integer deletePartner(Integer id) {return adminMapper.deletePartner(id);}

    public Partner selectPartnerById(Integer id) {return adminMapper.selectPartnerById(id);}

    public boolean updatePartnerAction(Partner partner) {return adminMapper.updatePartnerAction(partner);}

    public Page<Product> getProduct(String search) {return adminMapper.getProduct(search);}

    public boolean addProductAction(Product product) {return adminMapper.addProductAction(product);}

    public Integer deleteProduct(Integer id) {return adminMapper.deleteProduct(id);}

    public Product selectProductById(Integer id) {return adminMapper.selectProductById(id);}

    public boolean updateProductAction(Product product) {return adminMapper.updateProductAction(product);}

    public boolean saveConfig(String key, String value) {return adminMapper.saveConfig(key, value);}

    public Page<Log> getLog(String search) {return adminMapper.getLog(search);}

    public boolean recordLog(String ip, String os, String browser, String root, Timestamp createTime) {return adminMapper.recordLog(ip, os, browser, root, createTime);}
}
